<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <title>${r'$'}{setting.siteName} - 编辑${scheme.moduleName}</title>
    <meta name="keywords" content="${r'$'}{setting.siteName}">
  	<meta name="description" content="${r'$'}{setting.siteName}">
  	<!-- BEGIN HEADER -->
		[#include "/admin/include/style.ftl"]
	<!-- END HEADER -->
</head>
<body class="gray-bg">
    <div class="wrapper wrapper-content  animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                    	 <h5>编辑${scheme.moduleName}</h5>
                    	 <div class="ibox-tools">
                    	 	<button type="button" class="btn btn-outline btn-white btn-xs" id="btn-return-loippi" 
                    	 	onclick="location.href='${r'$'}{base}/admin/${classNamePath}/list.jhtml'"><i class="fa fa-reply-all"></i> 返回列表</button>
                        </div>
                    </div>            	
                  	<div class="ibox-content">
                  		<form id="inputForm" class="form-horizontal" action="${r'$'}{base}/admin/${classNamePath}/update.jhtml" method="post">
                  		<input type="hidden" value="${r'$'}{${table.className?uncap_first}.${table.classPk}}" name="${table.classPk}"/>
                       
                       		<#list table.columns?chunk(2) as row>
                           <div class="form-group">
                       		<div class="row">
                       		<#list row as column>
                       		<#if column.pk != 1>
                       			<div class="col-sm-6">
                       			 	<label class="col-sm-3 control-label"><#if column.nullable != 1><span class="required"> * </span></#if><#if column.comments?contains(":")><#list  column.comments?split(":") as coms><#if coms_index == 0>${coms}</#if></#list><#else>${column.comments}</#if></label>
	                                <div class="col-sm-9">
	                                	<#if column.showType == 'input'>
	                                    <input type="text" name="${column.javaField}" class="form-control" maxlength="200" value="${r'$'}{(${table.className?uncap_first}.${column.javaField}<#if column.javaType='java.util.Date'>?string('yyyy-MM-dd'))!''<#else>)!''</#if>}"/>
	                                    <#elseif column.showType == 'textarea'>
	                                    <textarea  name="${column.javaField}" class="form-control">${r'$'}{${table.className?uncap_first}.${column.javaField}}</textarea>
	                                    <#elseif column.showType == 'fulltext'>
	                                    <textarea id="editor" name="${column.javaField}" class="editor">${r'$'}{${table.className?uncap_first}.${column.javaField}}</textarea>
	                                    <#elseif column.showType == 'upload'>
	                                    <div class="input-group">
											<input type="text" class="form-control" name="${column.javaField}" id="${column.javaField}" value="${r'$'}{${table.className?uncap_first}.${column.javaField}}" >
											<span class="input-group-btn">
												<button class="btn btn-white browserButton" type="button" for="${column.javaField}"><i class="fa fa-send-o"></i>&nbsp;选择</button>
											</span>
										</div>
	                                    </#if>
	                                </div>
                       			</div>
                       		</#if>
                       		</#list>
							</div>
                        </div>
							<!--/row-->
							
							</#list>
                       		
                       
                         <div class="hr-line-dashed"></div>
	                    <div class="form-group">
	                        <div class="col-sm-12 col-sm-offset-10">
	                        	<button type="button" class="btn btn-default" onclick="window.history.back();">返回</button>
	                            <button class="btn btn-success" type="submit">保存内容</button>
	                        </div>
	                    </div>
	                    </form>
                  	</div>
                </div>
            </div>
        </div>
    </div>
	<!-- BEGIN Script -->
		[#include "/admin/include/script.ftl"]
	<!-- END Script -->
    <script>
        ${r'$'}(document).ready(function () {
        	[@flash_message /]
        	${r'$'}(".chosen-select").chosen({width:"100%"}); 
        	${r'$'}(".input-daterange").datepicker({keyboardNavigation:false,forceParse:false,autoclose:true});
        	
        	${r'$'}(".browserButton").browser({callback:function(url){
				$("#"+$(this).attr('for')).val(url);
			}});
        	
    		${r'$'}(".input-group.date").datepicker({todayBtn:"linked",keyboardNavigation:false,forceParse:false,calendarWeeks:true,autoclose:true});
        	${r'$'}("#inputForm").validate({
               rules: {
                	<#list table.columns as column>
                	<#if column.pk != 1 && column.nullable == 0>
                	 ${column.name}: {
						required: true
					}<#if column_has_next>,</#if>
					</#if>
                	</#list>
                },
                messages: {
				}
            });
        });
    </script>
</body>
</html>
